package com.qyhl.module_practice.common;


import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.List;

/**
 * Created by qyhl on 2018/2/26.
 */

public class Town2ListPagerAdapter extends FragmentPagerAdapter {
    private final List<Fragment> mFragment;
    private List<String> data;

    public Town2ListPagerAdapter(FragmentManager fm, List<Fragment> data) {
        super(fm);
        this.mFragment = data;
    }

    public void setData(List<String> data) {
        this.data = data;
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return data.get(position);
    }

    @Override
    public Fragment getItem(int position) {
        return mFragment.get(position);
    }

    @Override
    public int getCount() {
        return mFragment.size();
    }
}
